package com.yhgm.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yhgm.model.dto.user.UserQueryRequest;
import com.yhgm.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yhgm.model.vo.LoginUserVO;
import com.yhgm.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author Gaoming
 * @description 针对表【user(用户)】的数据库操作Service
 * @createDate 2024-03-22 21:32:01
 */
public interface UserService extends IService<User> {

    /**
     * 用户登录
     * @param username
     * @param password
     * @param request
     * @return
     */
    LoginUserVO userLogin(String username, String password, HttpServletRequest request);

    /**
     * 用户注册
     *
     * @param username   用户账户
     * @param password  用户密码
     * @param checkPassword 校验密码
     * @return 新用户 id
     */
    long userRegister(String username, String password, String checkPassword);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 获取脱敏的已登录用户信息
     *
     * @return
     */
    LoginUserVO getLoginUserVO(User user);

    /**
     * 获取脱敏的用户信息
     *
     * @param user
     * @return
     */
    UserVO getUserVO(User user);

    /**
     * 获取脱敏的用户信息
     *
     * @param userList
     * @return
     */
    List<UserVO> getUserVOList(List<User> userList);

    /**
     * 获取查询条件
     *
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 修改当前登录用户的密码
     *
     * @param id
     * @param newPassword
     * @return
     */
    Integer updatePassword(Long id, String newPassword);
}
